/**
 * @file: svg图标
 * @author: Lengxx
 * @date: 2024-07-24
 */

interface IconProps {
  name: string
  color?: string
  size?: number
  prefix?: string
}
export default function Icon(props: IconProps) {
  const {
    name,
    color = '#333',
    size = 16,
    prefix = 'icon'
  } = props;
  const symbolId = `#${prefix}-${name}`;
  const styles = {
    fill: color,
    width: `${size}px`,
    height: `${size}px`
  }

  return (
    <svg
    {...props}
    style={styles}
    aria-hidden="true"
  >
    <use xlinkHref={symbolId} />
  </svg>
  )
}